//package com.haiyi.activiti.engine.framework.activiti.controller;
//
//import com.haiyi.activiti.engine.model.entity.FormModel;
//import com.haiyi.activiti.engine.framework.activiti.manager.DeployManager;
//import com.haiyi.activiti.engine.framework.activiti.manager.FormManager;
//import com.haiyi.activiti.engine.framework.activiti.manager.ProcessManager;
//import com.haiyi.activiti.engine.framework.activiti.manager.TaskManager;
//import com.haiyi.activiti.engine.framework.basic.ResponseData;
//import com.haiyi.activiti.engine.framework.template.freemarker.FreemarkerBuilderAdapter;
//import org.activiti.engine.repository.Deployment;
//import org.activiti.engine.runtime.ProcessInstance;
//import org.activiti.engine.task.Task;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * <p> </p>
// *
// * <pre> Created: 2018/12/7 16:20 </pre>
// *
// * @author hlu
// * @version 1.0
// * @since JDK 1.7
// */
//@RestController
//@RequestMapping("/activiti")
//public class ActivitiController {
//
//    @Autowired
//    private DeployManager deployManager;
//    @Autowired
//    private FormManager formManager;
//    @Autowired
//    private TaskManager taskManager;
//    @Autowired
//    private ProcessManager processManager;
//    @Autowired
//    private FreemarkerBuilderAdapter freemarkerBuilderAdapter;
//
//    @GetMapping("/deploy")
//    public ResponseData deploy(String classPath){
//        final Deployment deployment = deployManager.deployByClassPath(classPath);
//        return ResponseData.ok(deployment.getId());
//    }
//
//    @GetMapping("/startProcess")
//    public ResponseData startProcess(String processKey){
//        final ProcessInstance processInstance = processManager.startProcessInstanceByKey(processKey);
//        return ResponseData.ok(processInstance.getId());
//    }
//
//    @GetMapping("/deleteDeploy")
//    public ResponseData deleteDeploy(String deployId){
//        deployManager.deleteDeployment(deployId,true);
//        return ResponseData.ok(true);
//    }
//
//    @GetMapping("/formResource")
//    public ResponseData getComponentDesign(String processInstanceId){
//        final Task currentTask = taskManager.getProcessCurrentTask(processInstanceId);
//        final String formKey = currentTask.getFormKey();
//        Map<String,Object> map = new HashMap<>(1);
//        map.put("formKey",formKey);
//        map.put("taskId",currentTask.getId());
//        final FormModel formModel = formManager.createFormModelQuery().iid(formKey).singleResult();
//        freemarkerBuilderAdapter.resolverFormModelJson(formModel,currentTask);
//        return ResponseData.ok(formModel.getComponentDesign(),map);
//    }
//
//    @GetMapping("/submitTaskForm")
//    public ResponseData submitTaskForm(String taskId,String formKey,Map<String,Object> params){
//        formManager.submitTaskForm(taskId, formKey, params);
//        return ResponseData.ok(true);
//    }
//
//}
